<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class Project extends Model
{
    use HasDateTimeFormatter, SoftDeletes;


    public function scopeShow($query)
    {
        return $query->where('show', true);
    }

    public function category(): BelongsTo
    {
        return $this->belongsTo(Category::class);
    }


    //资料
    public function material(): HasMany
    {
        return $this->hasMany(Material::class);
    }
}
